package cn.iocoder.yudao.module.scrm.dal.mysql.marketing;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.scrm.controller.admin.marketing.vo.look.MarketingLookPageReqVO;
import cn.iocoder.yudao.module.scrm.dal.dataobject.marketing.MarketingLookDO;
import cn.iocoder.yudao.module.scrm.dal.dataobject.marketing.MarketingVisitorDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 营销浏览 Mapper
 *
 * @author admin
 */
@Mapper
public interface MarketingLookMapper extends BaseMapperX<MarketingLookDO> {

    default PageResult<MarketingLookDO> selectPage(MarketingLookPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MarketingLookDO>()
                .eqIfPresent(MarketingLookDO::getContentId, reqVO.getContentId())
                .eqIfPresent(MarketingLookDO::getVisitorId, reqVO.getVisitorId())
                .eqIfPresent(MarketingLookDO::getSource, reqVO.getSource())
                .eqIfPresent(MarketingLookDO::getMaterialType, reqVO.getMaterialType())
                .eqIfPresent(MarketingLookDO::getTitle, reqVO.getTitle())
                .betweenIfPresent(MarketingLookDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(MarketingLookDO::getEndTime, reqVO.getEndTime())
                .betweenIfPresent(MarketingLookDO::getLookTime, reqVO.getLookTime())
                .eqIfPresent(MarketingLookDO::getPercentage, reqVO.getPercentage())
                .likeIfPresent(MarketingLookDO::getPrincipalName, reqVO.getPrincipalName())
                .eqIfPresent(MarketingLookDO::getTransmitId, reqVO.getTransmitId())
                .eqIfPresent(MarketingLookDO::getLinkId, reqVO.getLinkId())
                .eqIfPresent(MarketingLookDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(MarketingLookDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MarketingLookDO::getId));
    }

}